package com.example.xpagedemoproject.fragment;

import android.view.View;
import android.widget.TextView;

import com.example.xpagedemoproject1.R;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xpage.base.XPageFragment;
import com.xuexiang.xpage.enums.CoreAnim;
import com.xuexiang.xpage.logger.PageLog;
import com.xuexiang.xpage.utils.TitleBar;
import com.xuexiang.xutil.tip.ToastUtils;

import butterknife.BindView;
import butterknife.OnClick;

@Page(name = "TabA",anim = CoreAnim.none)
public class TabAFragment extends XPageFragment {
    public static final String TAG = "TabAFragment";
    @BindView(R.id.tv_content)
    TextView tvContent;
    private int mData;
    @Override
    protected int getLayoutId() {
        return R.layout.fragment_test;
    }

    @Override
    protected TitleBar initTitleBar() {
        return null;
    }

    @Override
    protected void initViews() {
        tvContent.setText("这里是" + getPageName() + " 页面");
        mData = (int) (Math.random() * 1000);
    }

    @Override
    protected void initListeners() {

    }

    @Override
    public void onResume() {
        super.onResume();
        PageLog.d(TAG + ":onResume");
    }

    @Override
    public void onPause() {
        super.onPause();
        PageLog.d(TAG + ":onPause");
    }

    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);
        PageLog.d(TAG + ":onHiddenChanged");
    }
    public String getData(){
        return "这是TabA的数据:" + mData;
    }

    @OnClick(R.id.tv_content)
    protected void onViewClicked(View view){
        ToastUtils.toast("您点击了TabAFragment的TextView");
    }
}
